package com.ali.coder;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * 自定义编码器
 */
public class MyMessageToByteEncoder extends MessageToByteEncoder<Long> {
    /**
     * 编码
     */
    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, Long aLong, ByteBuf byteBuf) {
        System.out.println("encode方法执行");
        System.out.println("aLong：" + aLong);
        byteBuf.writeLong(aLong);
    }
}
